package micro86.operation;

import micro86.engine.Memory;
import micro86.engine.State;
import micro86.engine.parametres.IntParameter;

/**
 * (c) Kate Luzhevskaya 2013
 */
public class IntMul  implements IOperation{
    IntParameter source;
    IntParameter destination;

    public IntMul(IntParameter source, IntParameter destination){
        this.source = source;
        this.destination = destination;
    }

    @Override
    public void execute(State state, Memory memory) {
        int targetValue = source.get(state) * destination.get(state);
        source.set(state, targetValue);
        state.setSFbyResult(targetValue);
        state.setZFByResult(targetValue);
        state.incIP();
    }
}
